package org.liquidByte.trafficMustang.androidApp.proxy;

public class RemoteException extends Exception {

	private static final long serialVersionUID = 7298433674493868199L;
    private String exceptionType;
    private String rootStackTrace;
    
	RemoteException(String message, String exceptionType, String rootStackTrace) {
		super(message);
		this.exceptionType = exceptionType;
		this.rootStackTrace = rootStackTrace;
	}
	
	public String getExceptionType() {
		return exceptionType;
	}
	public String getRootStackTrace() {
		return rootStackTrace;
	}
	
	static RemoteException fromError(ErrorMessage errorMsg) {
		if (errorMsg == null) {
			return null;
		} else {
			return new RemoteException(errorMsg.getMessage(), errorMsg.getExceptionType(), errorMsg.getStackTrace());
		}
	}
}
